<template>
  <el-tag v-for="item in items" @click="handleClick(item.path)" :key="item.label" :type="item.type" effect="dark">
    {{ item.label }}
  </el-tag>
</template>

<script setup lang="tsx" name="Tag">
import { useAuthStore } from "@/stores/modules/auth";
import { type TagProps } from "element-plus";
import { onMounted, ref, defineProps } from "vue";
import { useRouter } from "vue-router";
type Item = { type: TagProps["type"]; label: string; path: string };
const router = useRouter();
const authStore = useAuthStore();
let items = ref<Array<Item>>([
  { type: "info", label: `新注册(${authStore.tag.new})`, path: "/cityLevel/cityOrganization/cityDelivery/registNew" },
  { type: "info", label: `待审核(${authStore.tag.examine})`, path: "/cityLevel/cityOrganization/cityDelivery/examine" },
  { type: "info", label: `已通过(${authStore.tag.passed})`, path: "/cityLevel/cityOrganization/cityDelivery/passed" },
  { type: "info", label: `未通过(${authStore.tag.notPassed})`, path: "/cityLevel/cityOrganization/cityDelivery/notPassed" },
  { type: "info", label: `已取消(${authStore.tag.cancel})`, path: "/cityLevel/cityOrganization/cityDelivery/cancel" }
]);

const props = defineProps<{
  info: number;
}>();
console.log("这是传递的信息", props.info);
items.value[props.info].type = "primary";
const handleClick = (path: string) => {
  router.push({ path });
};

onMounted(() => {
  authStore.setTagsViewNew();
  authStore.setTagsViewExamine();
  authStore.setTagsViewPassed();
  authStore.setTagsViewNotPassed();
  authStore.setTagsViewCancel();
});
</script>
<style lang="scss" scoped>
.form-container {
  padding: 10px;
  margin-bottom: 10px;
  background-color: white;
  .btn-container {
    display: inline-block;
    float: right;
    vertical-align: middle;
    ::v-deep .el-button > span {
      font-size: 13px;
    }
  }
  .el-form {
    display: inline-block;
    ::v-deep .el-form-item__label {
      font-size: 13px;
    }
  }
  .form-line {
    .el-form-item {
      margin: 0;
      margin-right: 20px;
    }
    .el-input {
      width: 240px;
    }
    .el-select {
      width: 240px;
    }
  }
}
.table-container {
  padding: 40px 10px;
  padding-bottom: 60px;
  background-color: white;
  .pagination-container {
    // display: inline-block;
    float: right;
    margin-top: 20px;
    background-color: white;
  }
}
::v-deep .el-tag--dark {
  margin: 5px;
  cursor: pointer;
}
::v-deep .el-input--suffix .el-input__inner {
  padding-right: 15px;
}
::v-deep .el-form-item__label {
  font-size: 13px;
  font-weight: 100;
  color: black;
}
::v-deep .el-button > span {
  font-size: 13px;
}
::v-deep .el-input__inner {
  font-size: 13px;
}
</style>
